# 基础镜像
FROM node:18

ENV TZ Asia/Shanghai
ENV TZ=Asia/Shanghai 
RUN echo "${TZ}" > /etc/timezone \ 
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ 
&& apt update \ 
&& apt install -y tzdata \ 
&& rm -rf /var/lib/apt/lists/*


# 创建应用目录
WORKDIR /usr/src/app

# 使用通配符来确保 package.json 和 package-lock.json 被复制
COPY package*.json ./

# 启动服务
# COPY  ./node_modules ./node_modules
# COPY  ./dist ./dist
# 安装应用依赖

# 复制源代码
COPY . .

# RUN rm -r node_modules/sharp

# RUN SHARP_IGNORE_GLOBAL_LIBVIPS=1 npm_config_arch=x64 npm_config_platform=linux yarn add sharp@0.32.1

# Run npm install

# 构建应用，并创建「dist」目录

EXPOSE 3009



CMD [ "node", "dist/main.js" ]